package com.xxx.zuoye;

import java.io.*;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/8/2  19:04
 * @Copyright
 */
public class zuoye01 {
    public static void main(String[] args) {
        try {
            final InputStreamReader gbk = new InputStreamReader(new FileInputStream("./zuozye07/ch.txt"), "GBK");
            BufferedReader bufferedReader = new BufferedReader(gbk);

            final OutputStreamWriter utf = new OutputStreamWriter(new FileOutputStream("./zuozye07/ch1.txt"), "UTF-8");
            BufferedWriter bufferedWriter = new BufferedWriter(utf);

            int i = 0;
            while ((i = bufferedReader.read()) != -1) {

                bufferedWriter.write(i);
                System.out.println("i = " + i);
                System.out.println(bufferedReader.read());

            }
            bufferedReader.close();
            bufferedWriter.close();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
